// import { createApp } from 'vue'
// import { createPinia } from 'pinia'
// import App from './index'
import { defineAsyncComponent } from 'vue';
import './styles/index.scss';

import {
  createDiscreteApi,
  create,
  NColorPicker,
  NConfigProvider,
  NMessageProvider,
  NDialogProvider,
  NButton,
  NButtonGroup,
  NTag,
  NCollapse,
  NCollapseItem,
  NDataTable,
  NPopover,
  NDrawer,
  NDrawerContent,
  NModal,
  NCode,
  NForm,
  NFormItem,
  NInput,
  NInputNumber,
  NRadio,
  NRadioGroup,
  NCheckbox,
  NCheckboxGroup,
  NSelect,
  NSwitch
} from 'naive-ui';

const naive = create({
  components: [
    NColorPicker,
    NConfigProvider,
    NMessageProvider,
    NDialogProvider,
    NButton,
    NButtonGroup,
    NTag,
    NCollapse,
    NCollapseItem,
    NDataTable,
    NPopover,
    NDrawer,
    NDrawerContent,
    NModal,
    NCode,
    NForm,
    NFormItem,
    NInput,
    NInputNumber,
    NRadio,
    NRadioGroup,
    NCheckbox,
    NCheckboxGroup,
    NSelect,
    NSwitch
  ]
});

const { message, notification, dialog, loadingBar } = createDiscreteApi(['message', 'dialog', 'notification', 'loadingBar']);
window.__messageBox = message;

// import LucideIcon from '@wf/components/bpmnjs/components/common/LucideIcon.vue'
// import EditItem from '@wf/components/bpmnjs/components/common/EditItem.vue'
// import CollapseTitle from '@wf/components/bpmnjs/components/common/CollapseTitle.vue'

import 'virtual:svg-icons-register';

// import i18n from '@wf/components/bpmnjs/i18n'
const components = {
  LucideIcon: () => import('@wf/components/bpmnjs/components/common/LucideIcon.vue'),
  EditItem: () => import('@wf/components/bpmnjs/components/common/EditItem.vue'),
  CollapseTitle: () => import('@wf/components/bpmnjs/components/common/CollapseTitle.vue')
};

export default {
  install(Vue) {
    // Vue.use(i18n)
    // Vue.use(pinia)
    Vue.use(naive);
    Object.keys(components).forEach((key) => {
      Vue.component(key, defineAsyncComponent(components[key]));
    });
    // Vue.component('LucideIcon', LucideIcon)
    // Vue.component('EditItem', EditItem)
    // Vue.component('CollapseTitle', CollapseTitle)
  }
};
